<template>


         <div class="recharge">

        <div class="header"><van-nav-bar title="提现" left-text="返回"   @click-left="$router.go(-1)" left-arrow/></div>

        <div class="QRcode">
            <p><span>USDT</span></p>
         
        </div>

        <div class="USDT_link">
            <p>USDT地址：</p>
            <div val >
                 <van-cell-group>
                    <van-field   v-model="USDTaddress"  type="text"     placeholder="输入提币地址"/>
                </van-cell-group>
            </div>
             <p>数量：</p>
            <div val >
                 <van-cell-group>
                    <van-field    v-model="number"    @input="input" maxlength="10"    placeholder="请输入提币的数量"/>
                </van-cell-group>
            </div>
            <p>手续费：</p>
            <div val >
                 <van-cell-group>
                    <van-field     v-model="Handlingfee"  readonly     placeholder="提币数量*手续费率5%"/>
                </van-cell-group>
            </div>
            <div count> 
                
             
                
            </div>
            <div>
                <div style="padding-left:1rem;margin-bottom: 1rem;">到账数量：{{value}}</div>
            </div>
            
        </div>
        <div sub> <van-button type="default" @click="buy">提交</van-button></div>

        <div prompt>
            <div>1.请勿向上述地址充值任何非ERC-20USDT 资产，否则资产将不可找回。</div>
            <div> 2.最小充值金额为：1USDT，小于最小金额的充值将不会上账且无法退回。</div>
        </div>
     </div>


</template>

<script>

export default {

data() {
    return {
        QRcodeImg:require('../../assets/img/recharge_2.jpg'),
        data:{},
        value:0,
        USDTaddress:'',//usdt地址
        number:'',//数量
        Handlingfee:'',//手续费
    }
},
mounted() { 
    this.base.head_status()
   // this.show();
},

 methods: {
    input(){
        let that=this;
        
         that.number = that.number.replace(/\D/g, '')
         if(that.number>=50){
             that.Handlingfee=(that.number*0.05).toFixed(2);
             that.value=that.number-that.Handlingfee
         }else{
             that.Handlingfee=0;
              that.value=0;
         }
    },
    
     buy(){
          
    
            let that=this;
                if(!that.base.empty_b(that.USDTaddress)){
                 return      that.$toast({ message:"请输入USDT地址" })
            }
          
            if(that.number<50){
                 return      that.$toast({ message:"请输入提币数量，且必须大于50" })
            }
           that.$toast.loading({ message: '加载中...', forbidClick: true,overlay:true});
 
               var data={token:JSON.parse(localStorage.userinfo).token,url:that.data.usdt_addr,number:that.value}
              
                       that._API.withdrawal(data).then(res => {
                             that.$toast.clear();
                            if(res.code==200){
                               
                            }
                              that.$dialog.alert({title: '提示信息', message: res.msg }).then(() => {
                                
                                });
                           
                        }).catch(err => {
                            console.log("err", err);
                        });
     },
   
  


}
}
</script>


<style lang="scss" scoped >


    /deep/.van-nav-bar,/deep/.van-cell-group,/deep/.van-cell-group>div{background-color: initial;}
    /deep/.header *,/deep/.van-nav-bar .van-icon,/deep/.van-cell-group input{color:white}
    /deep/.van-cell-group{width: 100%}
    /deep/.van-cell-group>div{padding:0}
    .QRcode>p{padding: 1rem 20%;}
    .QRcode>p>span{border-bottom:2px solid #831BFA}
    .QRcode [pic]{text-align: center}
    .QRcode [pic] .van-button{background-color: #831BFA;color: white;border:0;border-radius: 3rem;margin-top: 1rem;    height: 1.875rem; line-height: 1.8rem;}
   
    .USDT_link>p{padding-left: 1rem;}
    .USDT_link [val]{display: flex;padding:.5rem 1rem;align-items: center;    box-shadow: inset 0 0 1rem 0px #7b00ff;margin: 1rem .8rem;border-radius: .5rem;font-size: 0.7rem;}
    .USDT_link>[but] {text-align: center;}
    .USDT_link>[but] .van-button{background-color: #831BFA;color: white;border:0;border-radius: 3rem;    height: 1.875rem;
    line-height: 1.8rem;}
    .USDT_link>[count] .van-slider{position: relative; box-shadow: inset 0 0 1rem 0px #7b00ff;margin: 1rem .8rem;border-radius: .5rem;background:initial}
    /deep/.van-progress__pivot{line-height: 2rem;    border-radius: .3rem;}

    .recharge [sub]{text-align: center;}
    .recharge [sub] .van-button{background-color: #831BFA;color: white;border:0;border-radius: 3rem;width: 90%;}


    [prompt]{margin: 1rem 0;}
    [prompt]>div{font-size: 0.7rem;margin: .0rem 5%;}
    /deep/.van-slider__bar{    border-radius: 0.5rem;widows: 50%}

    /deep/.van-slider__button-wrapper{    position: absolute; top: 50%;right: 0;-webkit-transform: translate3d(50%,-50%,0);transform: translate3d(50%,-50%,0);}
    /deep/ .custom-button{   height: 30px;background-color: white;border-radius: 0.2rem;-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.5);box-shadow: 0 1px 2px rgba(0,0,0,.5);}

    /deep/.van-dialog__header,/deep/.van-dialog{ color: black;background: red;}









       
</style>
